package com.oracle.common;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.oracle.service.FeignGetBoyService;
import com.oracle.vo.Boy;
import com.oracle.vo.Girl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;


import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @program: CampusMatching
 * @description:服务降级
 * @author: zhaolei
 * @create: 2020-07-25 15:59
 **/
@Component
public class FeignGetBoyServiceFallbackFactory implements FallbackFactory<FeignGetBoyService> {
    @Override
    public FeignGetBoyService create(Throwable throwable) {
                return new FeignGetBoyService() {
                    @Override
                    public List getBoy(Girl girl) {
                        System.out.println("get 降级了");
                        List list =new ArrayList();
                        Boy boy = new Boy();
                        boy.setBname("英俊");
                        boy.setBsex("男");
                        boy.setBheight("180");
                        boy.setBbirthday(new Date(1997 / 11 / 29));
                        boy.setBschool("哈佛大学");
                        boy.setBhobby("弹钢琴,冲浪");
                        list.add(boy);
                        return list;
                    }

                };
    }
}



